﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.fmtx.Model;
using com.fmtx.IDal;
using fmtx.Framework.NotSqlHelper;

namespace com.fmtx.Dal
{
    public class UserInfoServer : BaseServer<UserInfo>, IUserInfo
    {

        public IList<UserInfo> QueryArticleCount(int size)
        {
             var ulist = db.AllList(w => !w.IsSystem);
             return ulist.OrderByDescending(o => o.ArticleCount).Take(size).ToList();
        }


        public UserInfo Login(string uname, string password)
        {
            return db.AllList(w => w.Name == uname && w.PassWord == password).FirstOrDefault();
        }


        public bool IsExsts(string uname)
        {
            var has = db.AllList(w=>w.Name==uname||w.Email==uname).FirstOrDefault();
            if (has != null && has.Uid > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
